<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .new-list {
            height: 200px;
            overflow:auto;
            width: 400px;
            background-color: aliceblue;
        }
        .new-list li {
            border-bottom: 1px solid black;
        }
    </style>
</head>
<body>
    <div id="app"></div>
    <script type="text/javascript" src="../js/17/react.development.js"></script>
    <script type="text/javascript" src="../js/17/react-dom.development.js"></script>
    <script type="text/javascript" src="../js/17/babel.min.js"></script>
    <script type="text/babel">
    class NewList extends React.Component {

        getSnapshotBeforeUpdate(preProps, prestate) {
            console.log('preProps', preProps);
            console.log('prestate', prestate);
            console.log('getSnapShotBeforeUpdate');
            return 'adddd'
        }

        // 更新后
        componentDidUpdate(preProps, preState, snapshot) {
            console.log('componentDidUpdate');
            console.log('snapshot',snapshot);
        }
        
        render() {
            
            return (
                <div className="new-list">
                    <ul>
                        <li>新闻一</li>
                    </ul>
                </div>
            )
        }
    }
    
    // 渲染dom
    ReactDOM.render(<NewList />, document.getElementById('app'))
    </script>

</body>
</html>